package com.sysu.homework.service.Impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.sysu.homework.DAO.GroupDAO;
import com.sysu.homework.model.Group;
import com.sysu.homework.model.Student;
import com.sysu.homework.service.GroupService;

@Component("groupService")
public class GroupServiceImpl implements GroupService {
	private GroupDAO groupDAO; 
	

	@Override
	public Group getGroupById(int groupid) {
		if(groupid>0) 
			return groupDAO.getGroupById(groupid);
		return null;
	}

	@Resource
	public void setGroupDAO(GroupDAO groupDAO) {
		this.groupDAO = groupDAO;
	}
	public GroupDAO getGroupDAO() {
		return groupDAO;
	}

	@Override
	public List<Student> getGroupStudentsById(int groupid) {
		if(groupid>0)
			return groupDAO.getGroupStudentsById(groupid);
		return null;
	}

	@Override
	public List<Group> getAllGroups() {
		return groupDAO.getAllGroups();
	}
	
}
